package menu.service.impl;


import admin.dao.AdminDao;
import menu.service.MenuService;
import student.service.StudentServiceImpl;

import student.service.StudenttServiceImpl;
import teacher.service.impl.TeachercServiceImpl;



import java.util.Scanner;




public  class MenuServiceImpl implements MenuService {



    private TeachercServiceImpl teachercService = new TeachercServiceImpl();
    private StudenttServiceImpl studenttService=new StudenttServiceImpl();

    @Override
    public void mainMenu() {
        while (true) {
            //菜单具体的展示
            System.out.println("****************************************");
            System.out.println("      欢迎使用仁爱学院教务管理系统");
            System.out.println("                1.登录");
            System.out.println("                2.退出");
            System.out.println("****************************************");
            System.out.print("请输入你的选择：");
            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();
            switch (next) {
                case "1":
                    System.out.println("你选择了登录，即将跳转到用户登录");
                    loginMenu();
                    break;
                case "2":
                    System.out.println("系统即将退出.....");
                    System.out.println("欢迎下次使用");
                    return;
                default:
                    System.out.println("输入错误请重新输入");
            }
        }


    }


    @Override
    public void loginMenu() {
        while (true) {
            System.out.println("****************************************");
            System.out.println("      欢迎使用仁爱学院教务管理系统");
            System.out.println("                1.管理员登录");
            System.out.println("                2.教师登录");
            System.out.println("                3.学生登录");
            System.out.println("                4.退出");
            System.out.println("****************************************");
            System.out.print("请输入你的选择：");
            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();
            switch (next) {
                case "1":
                    System.out.println("正在进入管理员登录窗口");
                    adminaccount();
                    break;
                case "2":
                    System.out.println("正在进入教师登录窗口");
                   teachercService.teachercLogin();
                    break;
                case "3":
                    System.out.println("正在进入学生登录窗口");
                    studenttService.studenttLogin(); 
                break;
                case "4":
                    return;
                default:
            }
        }
    }


    @Override
    public void adminaccount() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("****************************************");
        System.out.print("请输入管理员账号:");
        String loginName = scanner.next();
        System.out.print("请输入管理员密码：");
        String loginPassword = scanner.next();
        if ("admin".equals(loginName) && "123456".equals(loginPassword)) {
            System.out.println("登陆成功");
            adminApp();
        } else {
            System.out.println("欢迎进入管理员菜单");

        }
    }

    @Override
    public void adminApp() {
        while (true) {
            System.out.println("****************************************");
            System.out.println("      欢迎使用仁爱学院教务管理系统（管理员端）");
            System.out.println("       1.教师管理");
            System.out.println("       2.学生管理");
            System.out.println("       3.个人信息");
            System.out.println("       4.退出");
            System.out.println("****************************************");
            System.out.println("请输入你的选择：");
            Scanner scanner=new Scanner(System.in);
            String next= scanner.next();
            switch (next) {
                case "1":
                    System.out.println("你选择了教师管理，即将跳转到教师管理！");
                    adminTeacherMenu();
                    break;
                case "2":
                    System.out.println("你选择了学生管理，即将跳转到学生管理！");
                    adminStudentMenu();
                    break;
                case "3":
                    System.out.println("你选择了个人信息，即将跳转到个人信息！");
                   adminMenu();
                    break;
                case "4":
                    System.out.println("退出");
                    return;
                default:
            }
        }
    }


    @Override
    public void adminMenu() {
        while (true){
            System.out.println("****************************************");
            System.out.println("      id:管理员1     ");
            System.out.println("      账号：admin    ");
            System.out.println("      密码：123456   ");
            System.out.println("          1.退出     ");
            System.out.println("****************************************");
            System.out.print("请输入你的选择：");
            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();
            switch (next) {
                case "1":
                    return;
                default:
            }
        }

    }

    @Override
    public void adminTeacherMenu() {

        while (true) {
            System.out.println("****************************************");
            System.out.println("            1.查看教师信息");
            System.out.println("            2.查看教师课表");
            System.out.println("            3.退出");
            System.out.println("****************************************");
            System.out.print("请输入你的选择：");
            Scanner scanner = new Scanner(System.in);

            String next = scanner.next();
            switch (next) {
                case "1":
                    new AdminDao().teacherSelect();
                    break;
                case "2":
                    new AdminDao().teachertimetable();
                    break;
                case "3":
                    return;
                default:
            }
        }
    }
        @Override
        public void adminStudentMenu() {
            while (true) {
                System.out.println("****************************************");
                System.out.println("            1.查看学生信息");
                System.out.println("            2.查看学生课表");
                System.out.println("            3.退出");
                System.out.println("****************************************");
                System.out.print("请输入你的选择：");

                Scanner scanner = new Scanner(System.in);

                String next = scanner.next();
                switch (next) {
                    case "1":
                       new AdminDao().studenSelect();
                        break;
                    case "2":
                        new AdminDao().studenttimetable();
                        break;
                    case "3":
                        return;
                    default:
                }
            }
    }





}